<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateWechatAuthorizeTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('wechat_authorize', function (Blueprint $table) {
            $table->bigIncrements('id');
            // 开放平台
            $table->unsignedBigInteger('platform_id')->default(0)->comment('开放平台');
            // 公众号
            $table->string('app_id', 32)->default('')->comment('应用标识');
            // 刷新token
            $table->string('refresh_token', 256)->default('')->comment('刷新令牌');
            // 功能授权
            $table->json('func_info')->nullable()->comment('功能授权');
            // 状态标识
            $table->tinyInteger('status', false, true)->default(1)->comment('状态,1|正常、2|禁用');
            // 创建时间
            $table->dateTimeTz('created_at')->nullable()->comment('创建时间');
            // 更新时间
            $table->dateTimeTz('updated_at')->nullable()->comment('更新时间');
            // 删除时间
            $table->dateTimeTz('deleted_at')->nullable()->comment('删除时间');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('wechat_authorize');
    }
}
